﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <%@ include file="../system/admin/top.jsp" %>
    <!-- jsp文件头和头部 -->
    <script src='static/js/jquery-1.9.1.min.js'></script>
    <script type="text/javascript" src="static/js/layer.js"></script>
    <link rel="stylesheet" href="static/css/ace.min.css"/>
    <link rel="stylesheet" href="static/css/ace-responsive.min.css"/>
    <link rel="stylesheet" href="static/css/ace-skins.min.css"/>
    <script type="text/javascript"  src="static/js/My97DatePicker/WdatePicker.js"></script>
    <script src='static/js/commonJs.js${getTime}'></script>
    <link rel="stylesheet" href="static/css/layui.css" media="all">
    <script type="text/javascript">
        function toDetail(callLoanNid, userId, repaymentId) {
            window.location = "cuijimanage/toDescPage.do?callLoanNid="
                + callLoanNid + "&userId=" + userId + "&repaymentId=" + repaymentId;
        }
        
    </script>
    <style>
        .divcss5 {
            width: 100px;
            height: 20px;
        }

         
    </style>
</head>
<body>
<br>
<div style="width: 2000px">
    <form action="<%=basePath%>taskdetails/list.do" method="post"
          name="pageForm" id="pageForm">
        <input type="hidden" id="proArr" name="ids">
        <input type="hidden" id="proArr1" name="ids1">
        <input type="hidden" id="overValue1" name="overValue" value="${pd.overValue }">
        <input type="hidden" id="overValueByDay1" name="overValueByDay" value="${pd.overValueByDay }">
        <input type="hidden" id="sortbylasttime1" name="sortbylasttime" value="${pd.sortbylasttime }">

        <!-- 组合查询 -->
        <div style="height:145px;width: 1750px;margin-left: 20px;">
            <table>
                <tr>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            借款产品:
                            <select id="productSource" class="chzn-select form-control" name="productSource"
                                    data-placeholder="不限"
                                    style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;">
                                <option value=""></option>
                                <option value="">请选择</option>
                                <option value="2"
                                        <c:if test="${pd.productSource=='2'}">selected</c:if> psId="182180001">今日现金
                                </option>
                                <option value="6"
                                        <c:if test="${pd.productSource=='6'}">selected</c:if> psId="186180001">卡贷
                                </option>
                                <option value="39"
                                        <c:if test="${'39' eq pd.productSource}">selected</c:if> psId="1839180001">融360
                                </option>
                                <option value="41"
                             			<c:if test="${'41' eq pd.productSource}">selected</c:if> psId="1841180001">消费分期
						        </option>
						        <option value="43"
						                 <c:if test="${'43' eq pd.productSource}">selected</c:if> psId="1843180001">游戏贷
						        </option>
						        <option value="8"
						            <c:if test="${'8' eq pd.productSource}">selected</c:if> psId="188180001">教育分期
						    	</option>
                                <option value="45"
                                        <c:if test="${'45' eq pd.productSource}">selected</c:if> psId="1839180002">
                                    游戏贷融360
                                </option>
                            </select>
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            入案时间:
                            <input type="text" id="minCreateTime" name="minCreateTime" class="form-control divcss5"
                                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate"
                                   value="${pd.minCreateTime}"/>至
                            <input type="text" id="maxCreateTime" name="maxCreateTime" class="form-control divcss5"
                                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate"
                                   value="${pd.maxCreateTime}"/>
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            分派时间:
                            <input type="text" id="minCallTime" name="minCallTime" class="form-control divcss5"
                                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate"
                                   value="${pd.minCallTime}"/>至
                            <input type="text" id="maxCallTime" name="maxCallTime" class="form-control divcss5"
                                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate"
                                   value="${pd.maxCallTime}"/>
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            最后催收时间:
                            <input type="text" id="lastCallTimeMin" name="lastCallTimeMin" class="form-control divcss5"
                                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate"
                                   value="${pd.lastCallTimeMin}"/>至
                            <input type="text" id="lastCallTimeMax" name="lastCallTimeMax" class="form-control divcss5"
                                   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate"
                                   value="${pd.lastCallTimeMax}"/>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            逾期阶段:
                            <select
                                    class="chzn-select form-control" id="overdueStage" name="overdueStage"
                                    data-placeholder="不限"
                                    style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;">
                                <option value=""></option>
                                <option value="">不限</option>
                                <option value="S1"
                                        <c:if test="${pd.overdueStage=='S1'}">selected</c:if>>S1
                                </option>
                                <option value="S2"
                                        <c:if test="${pd.overdueStage=='S2'}">selected</c:if>>S2
                                </option>
                                <option value="S2+"
                                        <c:if test="${pd.overdueStage=='S2+'}">selected</c:if>>S2+
                                </option>
                                <option value="M1"
                                        <c:if test="${pd.overdueStage=='M1'}">selected</c:if>>M1
                                </option>
                                <option value="M2"
                                        <c:if test="${pd.overdueStage=='M2'}">selected</c:if>>M2
                                </option>
                                <option value="M3"
                                        <c:if test="${pd.overdueStage=='M3'}">selected</c:if>>M3
                                </option>
                                <option value="M3+"
                                        <c:if test="${pd.overdueStage=='M3+'}">selected</c:if>>M3+
                                </option>
                            </select>
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            逾期天数:
                            <input autocomplete="off" type="text" id="minOverdueDate" class="form-control divcss5"
                                   name="minOverdueDate"
                                   style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                                   value="${pd.minOverdueDate}" checkNumber>至
                            <input autocomplete="off" type="text" id="maxOverdueDate" class="form-control divcss5"
                                   name="maxOverdueDate"
                                   style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                                   value="${pd.maxOverdueDate}" checkNumber>
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            待还金额:
                            <input autocomplete="off" type="text" id="minOverdueAmount" class="form-control divcss5"
                                   name="minOverdueAmount"
                                   style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                                   value="${pd.minOverdueAmount}">至
                            <input autocomplete="off" type="text" id="maxOverdueAmount" class="form-control divcss5"
                                   name="maxOverdueAmount"
                                   style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                                   value="${pd.maxOverdueAmount}">
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;">
                            未还罚息:
                            <input autocomplete="off" type="text" id="minOverdueFee" name="minOverdueFee"
                                   class="form-control divcss5"
                                   style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                                   value="${pd.minOverdueFee}">至
                            <input autocomplete="off" type="text" id="maxOverdueFee" name="maxOverdueFee"
                                   class="form-control divcss5"
                                   style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                                   value="${pd.maxOverdueFee}">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 22px ;margin-top :5px;">
                            催收组:&nbsp;&nbsp;&nbsp;
                            <select id="overdueDuration" class="chzn-select form-control" name="overdueDuration"
                                    data-placeholder="不限"
                                    style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;">
                                <option value=""></option>
                                <option value="">请选择催收组</option>
                                <option value="C-M1"
                                        <c:if test="${pd.overdueDuration=='C-M1'}">selected</c:if>>C~M1
                                </option>
                                <option value="M1-M2"
                                        <c:if test="${pd.overdueDuration=='M1-M2'}">selected</c:if>>M1~M2
                                </option>
                                <option value="M2-M3"
                                        <c:if test="${pd.overdueDuration=='M2-M3'}">selected</c:if>>M2~M3
                                </option>
                                <option value="M3+"
                                        <c:if test="${pd.overdueDuration=='M3+'}">selected</c:if>>M3+
                                </option>
                                <option value="S1"
                                        <c:if test="${pd.overdueDuration=='S1'}">selected</c:if>>S1
                                </option>
                                <option value="S2"
                                        <c:if test="${pd.overdueDuration=='S2'}">selected</c:if>>S2
                                </option>
                                <option value="S2+"
                                        <c:if test="${pd.overdueDuration=='S2+'}">selected</c:if>>S2+
                                </option>
                            </select>
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: 20px;margin-top :10px;">
                            催收员:
                        </div>
                        <div class="pull-left search" style="margin-left: 20px; margin-top :10px;">
                            <input autocomplete="off" type="text" id="usname" name="usname" class="form-control divcss5"
                                   style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                                   value="${pd.usname }">
                        </div>
                    </td>
                    <td>
                        <div class="pull-left search " style="text-align: center;margin-left: -110px;">
                            催收结果:
                            <select id="callResult" class="chzn-select form-control" name="callResult"
                                    data-placeholder="不限"
                                    style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;">
                                <option value=""></option>
                                <option value="">不限</option>
                                <c:forEach var="callResult" items="${callresulttypef}" varStatus="var">
                                    <option value="${callResult.key}"
                                            <c:if test="${pd.callResult eq callResult.key}">selected='selected'</c:if>>${callResult.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </td>
                </tr>
            </table>
            <div style="margin-top: -10px">
                <div class="pull-left" style="margin-left: 20px;margin-top: 10px">自定义项:
                    <input autocomplete="off" type="text" id="telephone" name="telephone" placeholder="手机号（本人）"
                           class="form-control divcss5"
                           value="${pd.telephone}" style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"/>
                </div>
                <div class="pull-left search" style="margin-left: 10px;margin-top: 10px">
                    <input autocomplete="off" type="text" id="contIdCard" class="form-control divcss5" name="contIdCard"
                           placeholder="借款人身份证"
                           value="${pd.contIdCard}" style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;">
                </div>
                <div class="pull-left search" style="margin-left: 10px;margin-top: 10px">
                    <input autocomplete="off" type="text" id="realName" class="form-control divcss5"
                           placeholder="借款人姓名"
                           name="realName"
                           value="${pd.realName}"
                           style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"/>
                </div>
                <div class="pull-left search" style="margin-left: 10px;margin-top: 10px">
                    <input autocomplete="off" id="borrowNid" type="text" class="form-control divcss5 "
                           placeholder="借款编号"
                           name="borrowNid" value="${pd.borrowNid }"
                           style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"/>
                </div>
                <div class="pull-left search" style="margin-left: 10px;margin-top: 10px">
                    <input autocomplete="off" id="callLoanNid" type="text" class="form-control divcss5 "
                           placeholder="催收编号"
                           name="callLoanNid" value="${pd.callLoanNid }"
                           style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"/>
                </div>
                <div class="pull-left search" style="margin-left: 10px;margin-top: 10px">
                    <input autocomplete="off" type="text" id="repaymentId" name="repaymentId"
                           class="form-control divcss5"
                           placeholder="还款订单号" style="font-size: 14px;padding: 4px 6px;color: #000;width: 100px;"
                           value="${pd.repaymentId}">
                </div>
            </div>


            <br/><br/>
            <!-- ==================按钮============================ -->
            <div style="width:100%;margin-top: 25px">
                <label class="btn btn-primary btn-small" id="searchList">查询</label>
                <script type="text/javascript">
                    //提交表单
                    $("#searchList").click(function () {
                        $("#overValue1").val("")
                        $("#overValueByDay1").val("")
                        $("#sortbylasttime1").val("")
                        set1("overValue","")
                        set1("overValueByDay","")
                        set1("sortbylasttime","")
                        $("#pageForm").checkNumber();
                    })
                </script>
                <label id="doEmpty" class="btn btn-primary btn-small">清空</label>
                <label id="biaoji" class="btn btn-primary btn-small" onclick="biaojis();">标记</label>
                <c:if test="${QX3 == 1}">
                    <label id="fenpai" class="btn btn-primary btn-small">批量分派</label>
                </c:if>
                <c:if test="${QX1 == 1}">
                    <label id="daochu" class="btn btn-primary btn-small">导出Excel</label>
                </c:if>
                <c:if test="${QX4 == 1}">
                    <label id="outPush" class="btn btn-primary btn-small">批量委外</label>
                </c:if>
                <c:if test="${QX5 == 1}">
                	<label id="caseBack" class="btn btn-primary btn-small">案件回收</label>
                </c:if>
                <br>
            </div>
            <!-- ==================按钮============================ -->
        </div>
        <!-- 高级查询=============================================================== -->
        <table id="table_report" class="table table-bordered table-hover" style="margin-left: 20px;margin-top: 70px;">

            <thead>
            <tr>
                <th align="center"><input id="checkAll"
                                          name="quanx" type="checkbox" style="position:relative;opacity:100;"/></th>
                <th>催收编号</th>

                <th>借款人姓名</th>
               <!--  <th>借款人身份证</th>
                <th>手机号</th>
                <th>借款编号</th> -->
                <th>借款产品名称</th>
                <th>逾期期数</th>
                <th>
                    <button id="overAmountOrd"
                            onclick="sortAmtSelect('${overValueByAmt}');">待还金额
                    </button>
                </th>
                <th>催收组</th>
                <th>
                    <button id="overDateOrd"
                            onclick="sortDateSelect('${overValueByDate}');">逾期天数
                    </button>
                </th>
                <th>
                    <button id="lastcalltime"
                            onclick="midsortbylasttime('${sortbylasttime}');">最后催收时间
                    </button>
                </th>
                <th>催收员</th>
                <th>催收結果</th>
                <th>逾期阶段</th>
                <th>催收状态</th>
                <th>分派时间</th>
                <th>入案时间</th>
                <!-- <th class="center">操作</th> -->
                <th>还款订单号</th>
            </tr>
            </thead>
            <tbody>
            <!-- 开始循环 -->
            <c:choose>
                <c:when test="${not empty pagelist}">
                    <c:forEach items="${pagelist }" var="var" varStatus="vs">
                        <tr style="background-color:
                        <c:if test="${var.call_mark==1}">red</c:if> "
                            align="center" height="40px">
                            <!-- 复选框 -->
                            <td align="center"><input id="${var.call_loan_nid}"
                                                      value="${var.call_mark}" name="subBox" type="checkbox"
                                                      style="position:relative;opacity:100;">
                            </td>
                            <!-- 催收编号 -->
                            <td>
                               <%-- <a href="javascript:void(-1);" style="color: blue"
                                   onclick="toDetail('${var.call_loan_nid}','${var.user_id}','${var.repayment_id}')">${var.call_loan_nid}</a>--%>
                                   <a href="javascript:void(0)" onclick="$.tiaozhuan(this,'${var.call_loan_nid}','${var.user_id}','${var.repayment_id}','${var.real_name}','zhong')"
                                      style="color: blue">
                                           ${var.call_loan_nid}
                                   </a>

                            </td>

                            <td>${var.real_name}</td>
                            <%-- <td>${var.cont_id_card}</td>
                            <td>${var.telephone}</td>
                            <td>${var.borrow_nid}</td> --%>
                            <td>${var.product_name}</td>
                            <td>${var.period }/${var.period_total }</td>
                            <!-- 逾期天数 -->
                            <td>${var.overdue_amount}</td>
                            <td>${var.overdue_duration}</td>
                            <td>${var.overdue_date}</td>
                            <td><fmt:formatDate value="${var.last_call_time }"
                                                pattern="yyyy-MM-dd HH:mm:ss"/>
                            </td>
                            <td>${var.usname}</td>
                            <td>
                                <c:forEach var="callResult" items="${callresulttypef}">
                                    <c:if test="${callResult.key eq var.call_result}">
                                        ${callResult.value}
                                    </c:if>
                                </c:forEach>
                            </td>
                            <td>${var.overdue_stage }</td>
                            <td><c:if test="${var.status == '0' }">
                                待催收
                            </c:if> <c:if test="${var.status == '1' }">
                                催收中
                            </c:if> <c:if test="${var.status == '2' }">
                                已结案
                            </c:if></td>
                            <td><fmt:formatDate value="${var.call_time }"
                                                pattern="yyyy-MM-dd HH:mm:ss"/>
                            </td>
                            <td><fmt:formatDate value="${var.create_time }"
                                                pattern="yyyy-MM-dd HH:mm:ss"/>
                            </td>
                            <td>${var.repayment_id}</td>
                        </tr>
                    </c:forEach>
                </c:when>
                <c:otherwise>
                    <tr class="main_info">
                        <td colspan="100" class="center">没有相关数据</td>
                    </tr>
                </c:otherwise>
            </c:choose>
            </tbody>
        </table>
        <div class="page-header position-relative">
            <span id="getSUM"></span>
            <table style="width: 100%;">
                <tr>
                    <td style="vertical-align: top;">
                        <div class="pagination"
                             style="float: right; padding-top: 0px; margin-top: 0px;">${page.pageStr}
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>
<!-- 引入 -->
<script type="text/javascript">
    window.jQuery
    || document
        .write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");
</script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/ace-elements.min.js"></script>
<script src="static/js/ace.min.js"></script>
<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script>
<script type="text/javascript"
        src="static/js/bootstrap-datepicker.min.js"></script>
<script src='static/js/commonJs.js${getTime}'></script>
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<script type="text/javascript" src="static/js/bootbox.min.js"></script>
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<script type="text/javascript">

    function set1(key, value) {
        window.localStorage[key] = value;
    }

    function get1(key, defaultValue) {
        return window.localStorage[key] || defaultValue;
    }

    function remove(key) {
        window.localStorage.removeItem(key);
    }

    var storage = window.localStorage;

    function clearSelect(id) {
        $(id + " option").removeAttr("selected");
        $(id + "_chzn a span").html("不限");
        //search();
    }

    function doEmpty() {
        $("#doEmpty").click(function () {
            $("[name='callLoanNid']").val("")
            $("[name='real_name']").val("")
            $("[name='contIdCard']").val("")
            $("[name='borrowNid']").val("")
            $("[name='realName']").val("")
            $("[name='repaymentId']").val("")
            $("[name='usname']").val("")
            $("[name='minOverdueDate']").val("")
            $("[name='maxOverdueDate']").val("")
            $("[name='minOverdueAmount']").val("")
            $("[name='maxOverdueAmount']").val("")
            $("[name='minOverdueFee']").val("")
            $("[name='maxOverdueFee']").val("")
            $("[name='minCreateTime']").val("")
            $("[name='maxCreateTime']").val("")
            $("[name='minCallTime']").val("")
            $("[name='maxCallTime']").val("")
            $("[name='lastCallTimeMin']").val("")
            $("[name='lastCallTimeMax']").val("")
            $("[name='telephone']").val("")
            $("#productSourceId").val("")
            clearSelect("#overdueDuration");
            clearSelect("#productSource");
            clearSelect("#callResult");
            clearSelect("#overdueStage");;
        });
    }

    //逾期金额和逾期天数排序
    function sortAmtSelect(i) {
        set1("callLoanNid", $("#callLoanNid").val())
        set1("callResult", $("#callResult").val())
        set1("real_name", $("#real_name").val())
        set1("overdueDuration", $("#overdueDuration").val())
        set1("contIdCard", $("#contIdCard").val())
        set1("borrowNid", $("#borrowNid").val())
        set1("realName", $("#realName").val())
        set1("repaymentId", $("#repaymentId").val())
        set1("usname", $("#usname").val())
        set1("overdueStage", $("#overdueStage").val())
        set1("minOverdueDate", $("#minOverdueDate").val())
        set1("maxOverdueDate", $("#maxOverdueDate").val())
        set1("minOverdueAmount", $("#minOverdueAmount").val())
        set1("maxOverdueAmount", $("#maxOverdueAmount").val())
        set1("minOverdueFee", $("#minOverdueFee").val())
        set1("minCreateTime", $("#minCreateTime").val())
        set1("maxOverdueFee", $("#maxOverdueFee").val())
        set1("maxCreateTime", $("#maxCreateTime").val())
        if (i == 1) {
            $("#overValue1").val("0")
        } else {
            $("#overValue1").val("1")
        }
        set1("overValue", $("#overValue1").val())
        $("#overValueByDay1").val("")
        $("#sortbylasttime1").val("")
        set1("sortbylasttime", "")
        set1("overValueByDay", "")
        $("#pageForm").submit();
    }

    function sortDateSelect(i) {
        set1("callLoanNid", $("#callLoanNid").val())
        set1("callResult", $("#callResult").val())
        set1("real_name", $("#real_name").val())
        set1("overdueDuration", $("#overdueDuration").val())
        set1("contIdCard", $("#contIdCard").val())
        set1("borrowNid", $("#borrowNid").val())
        set1("realName", $("#realName").val())
        set1("repaymentId", $("#repaymentId").val())
        set1("usname", $("#usname").val())
        set1("overdueStage", $("#overdueStage").val())
        set1("minOverdueDate", $("#minOverdueDate").val())
        set1("maxOverdueDate", $("#maxOverdueDate").val())
        set1("minOverdueAmount", $("#minOverdueAmount").val())
        set1("maxOverdueAmount", $("#maxOverdueAmount").val())
        set1("minOverdueFee", $("#minOverdueFee").val())
        set1("minCreateTime", $("#minCreateTime").val())
        set1("maxOverdueFee", $("#maxOverdueFee").val())
        set1("maxCreateTime", $("#maxCreateTime").val())
        if (i == 3) {
            $("#overValueByDay1").val("2")
        } else {
            $("#overValueByDay1").val("3")
        }
        set1("overValueByDay", $("#overValueByDay1").val())
        $("#overValue1").val("")
        set1("overValue", "")
        $("#sortbylasttime1").val("")
        set1("sortbylasttime", "")
        $("#pageForm").submit();
    }
    function midsortbylasttime(a){
        if (a == 1) {
            $("#sortbylasttime1").val("0")
        } else {
            $("#sortbylasttime1").val("1")
        }
        set1("overValueByDay","")
        $("#overValue1").val("")
        set1("overValue", "")
        $("#overValueByDay1").val("")
        $("#pageForm").submit();
    }
</script>
<script type="text/javascript">
    /* 下拉框 */
    $(top.hangge());

    //检索
    function search() {
        top.jzts();
        $("#pageForm").submit();
    }

    function test() {
    }

    $(function () {
        //单选框
        $(".chzn-select").chosen();
        $(".chzn-select-deselect").chosen({
            allow_single_deselect: true
        });
        //日期框
        $('.date-picker').datepicker();

        doEmpty();

    });

    $(function () {

    });


    /* 标记 */
    function biaojis() {
        var objs = document.getElementsByName('subBox')
        var idPros = new Array();
        var idPros1 = new Array();
        for (var i = 0; i < objs.length; i++) {
            if (objs[i].checked == true
                && $("#" + objs[i].id).attr("value") == "0") {
                idPros.push(objs[i].id);
            }
            if (objs[i].checked == true
                && $("#" + objs[i].id).attr("value") == "1") {
                idPros1.push(objs[i].id);
            }
        }
        $("#proArr").val(idPros)
        $("#proArr1").val(idPros1)
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "taskdetails/biaoji",
            data: $("#pageForm").serialize(),
            success: function (data) {
                if (data.num != 0) {
                    window.location.reload();
                }
            }
        });
    }

    /* 全选 */
    $(function () {
        $("#checkAll").click(function () {
            $('input[name="subBox"]').prop("checked", this.checked);
        });
        var $subBox = $("input[name='subBox']");
        $subBox
            .click(function () {
                $("#checkAll")
                    .prop(
                        "checked",
                        $subBox.length == $("input[name='subBox']:checked").length ? true
                            : false);
            });

        //分派
        $("#fenpai").click(function () {
            var arrChk = $("input[name='subBox']:checked");
            var fenpais = new Array();
            (arrChk).each(function () { //each() 遍历函数
                fenpais.push(this.id)
            });
            if (arrChk.length != 0) {
                openDialog({
                    title: "批量分派操作",
                    url: "taskdetails/plliangfenpailist?fpId=" + fenpais,
                    callBack: function () {
                        window.location.reload();
                    }
                });
            } else if (fenpais.length == 0) {
                layer.msg('勾选任务后再进行分派哦~', {
                    icon: 5,
                    time: 2000
                })
            }
        });
        /* 新导出 */
        $("#daochu").click(
            function () {
                if (($("[name='callLoanNid']").val()
                        || $("[name='callResult']").val()
                        || $("[name='real_name']").val()
                        || $("[name='overdueDuration']").val()
                        || $("[name='contIdCard']").val()
                        || $("[name='borrowNid']").val()
                        || $("[name='realName']").val()
                        || $("[name='repaymentId']").val()
                        || $("[name='usname']").val()
                        || $("[name='overdueStage']").val()
                        || $("[name='minOverdueDate']").val()
                        || $("[name='maxOverdueDate']").val()
                        || $("[name='minOverdueAmount']").val()
                        || $("[name='maxOverdueAmount']").val()
                        || $("[name='minOverdueFee']").val()
                        || $("[name='maxOverdueFee']").val()
                        || $("[name='minCreateTime']").val()
                        || $("[name='maxCreateTime']").val()
                        || $("[name='minCallTime']").val()
                        || $("[name='maxCallTime']").val()
                        || $("[name='lastCallTimeMin']").val()
                        || $("[name='lastCallTimeMax']").val()
                        || $("[name='telephone']").val()
                        || $("[name='productSource']").val()
                    )) {
                    window.location.href = '<%=basePath%>taskdetails/daochuexcsz.do?' + $("#pageForm").serialize();
                } else {
                    var index = layer.load();
                    layer.msg("请选择需要导出的数据", {
                        icon: 5,
                        time: 2000
                    });
                    layer.close(index);
                }
            });
	//委外
        $("#outPush").click(function () {
            var index = layer.load();
            var mapList = new Array();
            var selector = $("input[name='subBox']:checked");
            var ckLen = $(selector).size(), count = 0;
            $(selector).prop("checked", function (i, val) {
                if (val) {
                    mapList.push($(selector).eq(i).attr("id"));
                }
                else {
                    count++;
                }
            });
            if (ckLen == count) {
                layer.msg("请勾选要委外的数据！", {
                    icon: 5,
                    time: 2000
                });
                layer.close(index);
                return;
            } else {
                layer.confirm('是否确认批量委外?', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    $.ajax({
                        type: "post",
                        url: "loanTaskToBe/toWeiwai.do?ids=" + mapList +"&flag=1",
                        success: function (data) {
                            var result = data
                            if (data == 'success') {
                                layer.alert("委外成功")
                                window.location.reload();
                            } else {
                                layer.alert("委外失败")
                            }
                        }
                    })
                });
            }
            layer.close(index);
        });
        //案件回收
        $("#caseBack").click(function () {
            var index = layer.load();
            var mapList = new Array();
            var selector = $("input[name='subBox']:checked");
            var ckLen = $(selector).size(), count = 0;
            $(selector).prop("checked", function (i, val) {
                if (val) {
                    mapList.push($(selector).eq(i).attr("id"));
                }
                else {
                    count++;
                }
            });
            if (ckLen == count) {
                layer.msg("请勾选要回收的数据！", {
                    icon: 5,
                    time: 2000
                });
                layer.close(index);
                return;
            } else {
                layer.confirm('是否确认批量回收?', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    $.ajax({
                        type: "post",
                        url: "loanTaskToBe/innerCaseBack.do?ids=" + mapList,
                        success: function (data) {
                            var result = data
                            if (data == 'success') {
                                layer.alert("回收成功")
                                window.location.reload();
                            } else {
                                layer.alert("回收失败")
                            }
                        }
                    })
                });
            }
            layer.close(index);
        });
        //统计逾期总金额ajax请求
        $("#pageForm").getSUM('count/money/status/1');
    });

    /* 打开窗口 */
    function openDialog(options) {
        var defaultOptions = {
            title: "",
            url: "",
            callBack: function () {
            }
        };
        options = $.extend(defaultOptions, options);
        layer.open({
            title: options.title,
            fixed: false,
            type: 2,
            content: options.url,
            area: ['800px', '600px'],
            end: options.callBack
        });
    }
</script>
</body>
</html>

